home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / splitter / split2.frm < prev    next >
Text File  |  1996-02-06  |  4KB  |  146 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   5955
  5.    ClientLeft      =   1170
  6.    ClientTop       =   2295
  7.    ClientWidth     =   5670
  8.    Height          =   6645
  9.    Icon            =   "Split2.frx":0000
  10.    Left            =   1110
  11.    LinkTopic       =   "Form1"
  12.    MouseIcon       =   "Split2.frx":0442
  13.    ScaleHeight     =   397
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   378
  16.    Top             =   1665
  17.    Width           =   5790
  18.    Begin VB.PictureBox Sbar 
  19.       Align           =   2  'Align Bottom
  20.       Height          =   315
  21.       Left            =   0
  22.       ScaleHeight     =   255
  23.       ScaleWidth      =   5610
  24.       TabIndex        =   3
  25.       Top             =   5640
  26.       Width           =   5670
  27.    End
  28.    Begin VB.PictureBox Splitter 
  29.       Appearance      =   0  'Flat
  30.       BorderStyle     =   0  'None
  31.       ForeColor       =   &H80000008&
  32.       Height          =   4215
  33.       Left            =   2760
  34.       MouseIcon       =   "Split2.frx":0594
  35.       MousePointer    =   99  'Custom
  36.       ScaleHeight     =   281
  37.       ScaleMode       =   3  'Pixel
  38.       ScaleWidth      =   9
  39.       TabIndex        =   2
  40.       TabStop         =   0   'False
  41.       Top             =   540
  42.       Width           =   135
  43.    End
  44.    Begin VB.ListBox lstTel 
  45.       Height          =   4350
  46.       IntegralHeight  =   0   'False
  47.       Left            =   3180
  48.       TabIndex        =   1
  49.       Top             =   120
  50.       Width           =   2235
  51.    End
  52.    Begin VB.ListBox lstpers 
  53.       Height          =   4935
  54.       IntegralHeight  =   0   'False
  55.       Left            =   60
  56.       TabIndex        =   0
  57.       Top             =   180
  58.       Width           =   2475
  59.    End
  60.    Begin VB.Menu mnuBar 
  61.       Caption         =   "&Exit"
  62.       Index           =   100
  63.    End
  64. End
  65. Attribute VB_Name = "form1"
  66. Attribute VB_Creatable = False
  67. Attribute VB_Exposed = False
  68. Option Explicit
  69. Private Const P_ECART = 3
  70. Private y1 As Integer
  71. Private y2 As Integer
  72. Private x1 As Integer
  73. Private x2 As Integer
  74. Private width1 As Integer
  75. Private width2 As Integer
  76. Private height1 As Integer
  77. Private height2 As Integer
  78. Private glbfrmInSizeX As Long
  79.  
  80. Private Sub Form_Load()
  81.     glbfrmInSizeX = &H7FFFFFFF
  82.     Form_Resize
  83. End Sub
  84.  
  85. Private Sub splitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  86.     If glbfrmInSizeX <> &H7FFFFFFF Then
  87.         If CLng(x) <> glbfrmInSizeX Then
  88.             Splitter.Move Splitter.Left + x, y1, P_ECART, ScaleHeight - Sbar.Height - 2
  89.             glbfrmInSizeX = CLng(x)
  90.         End If
  91.     End If
  92. End Sub
  93.  
  94. Private Sub splitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  95.     If glbfrmInSizeX <> &H7FFFFFFF Then
  96.         If CLng(x) <> glbfrmInSizeX Then
  97.             Splitter.Move Splitter.Left + x, y1, P_ECART, ScaleHeight - Sbar.Height - 2
  98.         End If
  99.         glbfrmInSizeX = &H7FFFFFFF
  100.         Splitter.BackColor = &H8000000F
  101.         If Splitter.Left > 60 And Splitter.Left < (ScaleWidth - 60) Then
  102.             LstPers.Width = Splitter.Left - LstPers.Left
  103.         ElseIf Splitter.Left < 60 Then
  104.             LstPers.Width = 60
  105.         Else
  106.             LstPers.Width = ScaleWidth - 60
  107.         End If
  108.         Form_Resize
  109.     End If
  110. End Sub
  111.  
  112. Private Sub splitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  113.     If Button = vbLeftButton Then
  114.         Splitter.BackColor = &H808080
  115.         glbfrmInSizeX = CLng(x)
  116.     Else
  117.         If glbfrmInSizeX <> &H7FFFFFFF Then
  118.             splitter_MouseUp Button, Shift, x, y
  119.         End If
  120.         glbfrmInSizeX = &H7FFFFFFF
  121.     End If
  122. End Sub
  123.  
  124. Private Sub Form_Resize()
  125.     Const B_ECART = 1
  126.     On Error Resume Next
  127.  
  128.     y1 = B_ECART
  129.     height1 = ScaleHeight - Sbar.Height - B_ECART * 2
  130.     x1 = B_ECART
  131.     width1 = LstPers.Width
  132.     x2 = x1 + LstPers.Width + P_ECART - 1
  133.     width2 = ScaleWidth - x2 - B_ECART
  134.     
  135.     LstPers.Move x1 - 1, y1, width1, height1
  136.     lstTel.Move x2, y1, width2 + 1, height1
  137.     Splitter.Move x1 + LstPers.Width - 1, y1, P_ECART, height1
  138.     
  139. End Sub
  140.  
  141. Private Sub mnuBar_Click(Index As Integer)
  142.     Unload Me
  143. End Sub
  144.  
  145.  
  146.